import { Component } from 'react'
import { View, Text } from '@tarojs/components'
import './event.less'

export default class Event extends Component {

    state = {
        title: 'Event页面'
    }

    parentClickHandle() {
        console.log('parentClickHandle')
    }

    clickHandle(event) {
        console.log(this.state)
        console.log(event)
        // 阻止事件冒泡，事件就不会向父组件进行传递；
        // event.stopPropagation()
    }

    clickParamsHandle(e) {
        console.log(arguments)
        // Arguments(3) ['我是第一个参数', 'Event页面', PointerEvent]
    }

    render() {
        return (
            <View onClick={this.parentClickHandle.bind(this)} className='container'>
                <Text onClick={this.clickHandle.bind(this)}>测试事件</Text>
                <Text onClick={this.clickParamsHandle.bind(this, '我是第一个参数', this.state.title)}>点击事件传值</Text>
            </View>
        )
    }

}
